#!/usr/bin/csh

setenv PYTHONPATH /opt2/LogCatcherTool
set CMDF = "/opt2/LogCatcherTool/workspace/suites/mod_hot/mod_hot_wa.py --hot "
set CONFIGF = /opt2/LogCatcherTool/onshs/ne/tnxxx
set PINGC   = 'ping '

clear
date
echo "-- Modify HoldOffTime Script v1.0 Start --"

echo "-*******************************************-"
echo "The process is displayed while operating now. "
echo "-*******************************************-"
echo ""
echo ""

while 1
  echo -n "Input target ne IP-Address  : "
  set gaddr = $<

  echo -n "Input new HoldOffTime value : "
  set gval = $<

  echo "--------------------------------------------------------"
  echo " your enter IP-Address is $gaddr "
  echo " your enter HoldOffTime is $gval, Are you sure?"
  echo "--------------------------------------------------------"
  echo ""
  echo -n "Input < y or n , q is stopped > : "
  set gyn = $<
  switch ( $gyn )
    case "y"
      goto start
      breaksw
    case "q"
      echo "script end."
      exit
      breaksw
    case "n"
    defalt:
  endsw
end

start:

sleep 1
$PINGC $gaddr 1 > /dev/null 

if ($status == 0) then
  echo ""
  echo "-*******************************************-"
  echo "          $gaddr ping check OK."
  echo "-*******************************************-"
  echo ""
else
  echo ""
  echo "-*******************************************-"
  echo "          $gaddr ping check NG."
  echo "-*******************************************-"
  echo ""
  echo "script end."
  echo ""
  exit
endif

echo ""

sleep 1; echo "script start. "; echo ""
sleep 1; echo "target ne is $gaddr. "; echo ""

echo ""
echo ""
echo "          ##############################"
echo "          ### Ok. Let's start script. ##"
echo "          ##############################"
echo ""
echo ""
echo -n "          "; date
sleep 1; echo "              3"
sleep 1; echo "              2"
sleep 1; echo "              1"
echo $gaddr > ip.txt
$CMDF $gval 
sleep 1; echo ""
echo -n "  -- Thank you for your help.  " ; date
echo ""
